home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software of the Month Club 1996 June
/
Software of the Month Club 1996 June.iso
/
mac
/
ISO9660
/
DOS
/
DTP
/
AURORA
/
CLRCHART.AML
< prev
next >
Wrap
Text File
|
1995-02-24
|
4KB
|
130 lines
// ───────────────────────────────────────────────────────────────────
// Simple color chart 2/2/94
//
// This external AML macro displays a color chart with color attribute
// codes in decimal and hexidecimal. It can be helpful when configuring
// COLOR.AML. To enter a color string (e.g. 'red on blue') in your text:
//
// 1. run this macro
// 2. position the cursor to the desired color
// 3. press <enter>
//
// An easy way to run this macro is to place it in your MACRO
// subdirectory and select it from the macro picklist <shift f12>.
// Don't forget to compile it first. To compile, press <shift f10>
// when this source is displayed in an edit window.
// ───────────────────────────────────────────────────────────────────
include bootpath "define.aml"
var foreground
var background
// return the color name for a color attribute
function attrname (attr)
case attr
when 0 "black" when 8 "darkgray"
when 1 "blue" when 9 "brightblue"
when 2 "green" when 10 "brightgreen"
when 3 "cyan" when 11 "brightcyan"
when 4 "red" when 12 "brightred"
when 5 "magenta" when 13 "brightmagenta"
when 6 "brown" when 14 "yellow"
when 7 "gray" when 15 "white"
end
end
// create the color chart window
createwindow
setwinobj
setframe ">b"
setcolor border_color color gray on black
setcolor text_color color black on gray
settitle "Color Chart - press <enter> to select"
setwinctrl '≡'
sizewindow 27 4 74 20 "ad"
setborder "1f"
setcolor text_color color black on black
// draw the color chart
while foreground < 16 do
while background < 16 do
writestr " A " background * 16 + foreground
background = background + 1
end
writeline
background = 0
foreground = foreground + 1
end
foreground = 0
background = 0
showcursor 50 99
loop
attr = foreground + background * 16
colorstring = (attrname foreground) + ' on ' + (attrname background)
// write color info at the bottom of the chart
writestr '[dec=' + attr + ',hex=' + (base attr 16) + '] ' +
colorstring + " "
(color gray on black) 2 17
// move the cursor to the appropriate color cell
x = background * 3 + 2
gotoxy x foreground + 1
// write the bracket [ ] cursor
attr = (if? background > brightblue black white) + background * 16
writestr '[' attr x - 1
writestr ']' attr x + 1
gotoxy x foreground + 1
// display the window and get the next key
keycode = getkey
// clear the bracket cursor
writestr " A " foreground + background * 16 x - 1
case keycode
// exit the chart
when <esc>
break
// mouse click
when <button>
case getregion
// client area
when 1
if virtorow <= 16 then
foreground = (virtorow - 1) mod 16
end
background = (virtocol - 1) / 3
// close icon
when 51
break
end
// enter the color description in an edit window and exit
when <enter>
queue "write" colorstring
break
// move the cursor around in the chart
when <left>
background = if? background (background - 1) 15
when <right>
background = (background + 1) mod 16
when <up>
foreground = if? foreground (foreground - 1) 15
when <down>
foreground = (foreground + 1) mod 16
end
end
// destroy the color chart window
destroywindow